package com.blockmeta.bbs.businesslibrary.websocket;

/**
 * Created by websocket
 */
public class ConnectInfo
{
    public String m_strType; // connect type, SIM \ INC \ LIVE
    public String m_strIP;
    public int m_nPort;

    public ConnectInfo()
    {
        m_strType = null;
        m_strIP = "";
        m_nPort = 0;
    }

    public ConnectInfo(String type, String ip, int port)
    {
        m_strType = type;
        m_strIP = ip;
        m_nPort = port;

        check();
    }

    public ConnectInfo(ConnectInfo info)
    {
        m_strType = info.m_strType;
        m_strIP = info.m_strIP;
        m_nPort = info.m_nPort;
    }

    public ConnectInfo(String ip, int port)
    {
        m_strIP = ip;
        m_nPort = port;
    }


    public void check()
    {
//        if ("61.152.93.136".equals(m_strIP) && m_nPort == 8882)
//        {
//            m_strIP = "192.168.4.152";
//        }
    }

    public boolean update(ConnectInfo info)
    {
        boolean update = false;

        if (!m_strIP.equals(""))
            update = (!m_strIP.equals(info.m_strIP) || m_nPort != info.m_nPort);

        m_strType = info.m_strType;
        m_strIP = info.m_strIP;
        m_nPort = info.m_nPort;

        return update;
    }
}
